// custom-tab-bar/index.js
Component({
    /**
     * 组件的属性列表
     */
    properties: {

    },

    /**
     * 组件的初始数据
     */
    data: {
        selected: 0,
        color: "#999999",
        selectedColor: "#1296db",
        listTab: [
            {
                "pagePath": "/mypages/index/index",
                "text": "首页",
                "iconPath": "/images/tabbar/home_up.png",
                "selectedIconPath": "/images/tabbar/home_on.png"
            },
            {
                "pagePath": "/mypages/search/search",
                "text": "攻略",
                "iconPath": "/images/tabbar/gl_up.png",
                "selectedIconPath": "/images/tabbar/gl_on.png"
            },
            {
                "pagePath": "/mypages/my/my",
                "text": "我的",
                "iconPath": "/images/tabbar/my_up.png",
                "selectedIconPath": "/images/tabbar/my_on.png"
            }
        ]
    },

    /**
     * 组件的方法列表
     */
    methods: {
        switchTab(e) {
            const data = e.currentTarget.dataset;
            const url = data.path;
            wx.switchTab({ url });
            this.setData({
                selected: data.index
            })
        }
    }
})